const data = {
  state: {
    publicSingleData: {}
  },
  mutations: {
    SET_PUBLICSINGLEDATA: (state, data) => {
      state.publicSingleData = data
    }
  },
  actions: {
    SetpublicSingleData({ commit }, data) {
      return new Promise(resolve => {
        sessionStorage.setItem('publicSingleData', JSON.stringify(data))
        commit('SET_PUBLICSINGLEDATA', data)
        resolve()
      })
    },
    GetpublicSingleData({ commit }) {
      return new Promise((resolve, reject) => {
        const Info = JSON.parse(sessionStorage.getItem('publicSingleData'))
        commit('SET_PUBLICSINGLEDATA', Info)
        if (Info) {
          resolve()
        } else {
          reject('异常操作')
        }
      })
    }
  }
}

export default data
